package cn.buk.tms.entity.misc;

import com.fasterxml.jackson.annotation.JsonFormat;

import jakarta.persistence.*;
import java.util.Date;

/**
 * 企业微信中对应的部门ID的值需要一致
 * @author yfdai
 */
@Entity
@Table(name = "t105", uniqueConstraints = @UniqueConstraint(name = "uk_ent_department", columnNames = {"enterprise_id", "name"}))
public class EntDepartment {

  /**
   *所有人
   */
  public static final int ALL_EMPLOYEE = 0;
  /**
   * 管理部门
   */
  public static final int DEPT_ADMINISTRATOR = 10000;
  /**
   * 客服部
   */
  public static final int DEPT_CUSTOMER_SERVICE = 10010;
  /**
   * 出票部
   */
  public static final int DEPT_TICKETING = 10020;
  /**
   * 财务部
   */
  public static final int DEPT_CASHIER = 10030;

  /**
   * 机场服务部
   */
  public static final int DEPT_VAAS_SERVICE = 10090;

  /**
   * 携程网销部
   */
  public static final int DEPT_OTA_CTRIP = 20010;

  @Id
  @GeneratedValue(strategy = GenerationType.IDENTITY)
  private int id;

  /**
   * 企业
   */
  @Column(name = "enterprise_id")
  private int enterpriseId;

  /**
   * 以下参数与企业微信中的部门接口参数匹配
   */

  @Column(length = 64)
  private String name;

  /**
   * 部门默认的角色代码, 同RoleInfo中的代码
   */
  @Column(name = "role_code", length = 20)
  private String role;

  /**
   * 角色名称
   */
  @Transient
  private String roleName;

  @Column(name = "ww_parent_id")
  private int parentId;

  /**
   * 显示时的排序号
   */
  @Column(name = "ww_order")
  private int orderNo;

  /**
   * 企业微信中部门的id
   */
  @Column(name = "ww_dept_id")
  private int deptId;

  /**
   * 备注
   */
  @Column(length = 50)
  private String remark;

  @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
  @Temporal(TemporalType.TIMESTAMP)
  @Column(name = "create_time", insertable = false, updatable = false)
  private Date createTime;

  @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
  @Temporal(TemporalType.TIMESTAMP)
  @Column(name = "last_update", insertable = false)
  private Date lastUpdate;


  public int getId() {
    return id;
  }

  public void setId(int id) {
    this.id = id;
  }

  public String getName() {
    return name;
  }

  public void setName(String name) {
    this.name = name;
  }

  public int getParentId() {
    return parentId;
  }

  public void setParentId(int parentId) {
    this.parentId = parentId;
  }

  public int getOrderNo() {
    return orderNo;
  }

  public void setOrderNo(int orderNo) {
    this.orderNo = orderNo;
  }

  public int getDeptId() {
    return deptId;
  }

  public void setDeptId(int deptId) {
    this.deptId = deptId;
  }

  public int getEnterpriseId() {
    return enterpriseId;
  }

  public void setEnterpriseId(int enterpriseId) {
    this.enterpriseId = enterpriseId;
  }

  public Date getCreateTime() {
    return createTime;
  }

  public void setCreateTime(Date createTime) {
    this.createTime = createTime;
  }

  public Date getLastUpdate() {
    return lastUpdate;
  }

  public void setLastUpdate(Date lastUpdate) {
    this.lastUpdate = lastUpdate;
  }

  public void setRemark(String remark) {
    this.remark = remark;
  }

  public String getRemark() {
    return remark;
  }

  public String getRole() {
    return role;
  }

  public void setRole(String role) {
    this.role = role;
  }

  public String getRoleName() {
    return roleName;
  }

  public void setRoleName(String roleName) {
    this.roleName = roleName;
  }
}
